package com.hsp.Demo_13_exception;

import java.util.Scanner;

public class Demo_02 {
    public static void main(String[] args) {
        boolean flag = true;
        do{
            System.out.println("请输入一个整数：");
            Scanner scanner = new Scanner(System.in);
            try {
                int i = scanner.nextInt();
                System.out.println("输入的整数为：" + i);
                flag =false;
            } catch (Exception e) {
                e.printStackTrace();
                System.out.println("输入的不是整数，请重新输入！");
                System.out.println("hahaha");
            }

        }while(flag);

        System.out.println("结束了");
    }
}
